package com.qf.logistics.controller;

import com.github.pagehelper.PageInfo;
import com.qf.logistics.dto.R;
import com.qf.logistics.pojo.MemberProfile;
import com.qf.logistics.service.MemberProfileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * created by 赵文韬 on 2022/4/3 19:59
 */
@Controller
@RequestMapping("/member")
public class MemberProfileController {
    private MemberProfileService memberProfileService;
    @Autowired
    public void setMemberProfileService(MemberProfileService memberProfileService) {
        this.memberProfileService = memberProfileService;
    }
    @PostMapping("/findByKeyWord")
    public R findMemberProfileByKeyword(String keyword,Long gender,Long start,Long end,@RequestParam(defaultValue = "1") int pagenum,@RequestParam(defaultValue = "20") int pagesize){
        PageInfo<MemberProfile> pageInfo = memberProfileService.findByKeyWord(keyword, gender, start, end, pagenum, pagesize);
        return R.getR(1,"查询成功" ,pageInfo );
    }
    @PostMapping("/findById/{id}")
    public R findMemberById(Long id){
        MemberProfile memberProfileServiceById = memberProfileService.findById(id);
        return R.getR(1,"查询成功" ,memberProfileServiceById );
    }


}
